package servlet.article;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.Article;
import service.ArticleService;

/**
 * Servlet implementation class ArticleListServlet
 */
@WebServlet("/ArticleListServlet")
public class ArticleListServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		ArticleService service = new ArticleService();
		
		List<Article> articles = service.list();
	
		request.setAttribute("articles", articles);
		request.getRequestDispatcher("article/article_list.jsp").forward(request, response);
	}

	

}
